package odgs.app;

public class Util {
	public static String getSizeFormat(long s) {
		int count = 0;

		float size = s;

		while (size > 1024) {
			size /= 1024;
			count++;
		}

		String type = "";

		if (count == 0)
			type = " Byte";
		else if (count == 1)
			type = " KB";
		else if (count == 2)
			type = " MB";
		else if (count == 3)
			type = " GB";
		else if (count == 4)
			type = " TB";
		else if (count == 5)
			type = " PB";

		String capa = Float.toString(size);
		int dotIndex = capa.indexOf(".");

		return capa.substring(0, dotIndex + 2) + type;
	}
}